<script setup>
import { ref } from 'vue';

const myTitle = ref(null)

const changeTitle = () => {
  const dom = myTitle.value
  console.log(dom.innerText);
  dom.innerText = '修改后的标题'
}

</script>

<template>
  <h1 ref="myTitle">这是标题</h1>
  <button @click="changeTitle">改标题操作dom</button>
</template>